import * as React from "react";
import { Row, Col } from "antd";
import SearchCondition from "./compontents/SearchCondition";
import DeviceTable from "./compontents/DeviceTable";
import "./index.less";
export interface DeviceManagerProps {}

export interface DeviceManagerState {
  queryData: SearchConditionData;
}
export interface SearchConditionData {
  terVal: string;
  devVal: string;
  energyType: string;
  isLoad: string;
  typeId: string;
}
class DeviceManager extends React.Component<
  DeviceManagerProps,
  DeviceManagerState
> {
  state = {
    queryData: {
      devVal: "",
      terVal: "",
      typeId: "",
      energyType: "",
      isLoad: "",
      isBing: "",
      isFictitious: "0",
      isLineMain: "",
    },
  };
  render() {
    return (
      <div className="DeviceManager">
        <Row>
          <Col span={24} style={{ paddingBottom: 12 }}>
            <SearchCondition
              onSubmit={(data: any) => {
                this.getSearchCondition(data);
              }}
            />
          </Col>
          <Col span={24}>
            <DeviceTable queryData={this.state.queryData} />
          </Col>
        </Row>
      </div>
    );
  }
  /**回调 */
  getSearchCondition(data: any) {
    this.setState({ queryData: data });
  }
}

export default DeviceManager;
